<template>
	<view class="cardinfo">
			<u-navbar  :autoBack="true"  title="健康卡详情"></u-navbar>
		</u-navbar>
		<view class="cardimg">
			<view class="img">
				<image :src="'data:image/jpg;base64,' + info.QrCode" mode=""></image>
			</view>
			<view class="info">
				就诊时出示此二维码
			</view>
		</view>
		<view class="uerinfo">
			<view class="userinfoitem">
				<view class="iteml">
					姓名
				</view>
				<view class="itemr">
					{{info.name}}
				</view>
			</view>
			<view class="userinfoitem">
				<view class="iteml">
					证件号码
				</view>
				<view class="itemr">
					{{info.cardno}}
				</view>
			</view>
			<view class="userinfoitem">
				<view class="iteml">
					手机号
				</view>
				<view class="itemr">
					{{info.mobile}}
				</view>
			</view>
		</view>
		<u-modal :showCancelButton="true" @cancel="cancel()" @confirm="queding()" :show="showw" :title="title" :content='content'></u-modal>
	<view class="jibang" v-if="show" @click="jiebang()">
	   解绑健康卡
	</view>
	</view>
</template>

<script>
	import homeApii from '@/api/homee'
	export default {
		data() {
			return {
				showw:false,
							title:'温馨提示',
							content:'您确定要解绑此卡吗？',
				info:"",
				show:true
			}
		},
		onLoad(option) {
			const item = JSON.parse(decodeURIComponent(option.info));
			this.info=item
			if(option.type==1){
				this.show=false
			}
			console.log(option.type,"11111")
			if(option.type==2){
				this.show=true
			}
		},
		methods: {
			cancel(){
				this.showw=false
			},
			queding(){
				let token=uni.getStorageSync("token")
				homeApii.delzidang({
					token:token,
					pid:this.info.userid
				}).then(res=>{
					if(res.code==4000){
						uni.showToast({
							title:"解绑成功",
							icon:"none"
						})
						this.showw=false
					uni.navigateBack({
					    delta: 1
					});
				
					}
				})
			},
			jiebang(){
				this.showw=true
				// let token=uni.getStorageSync("token")    
				// homeApii.delzidang({
				// 	token:token,
				// 	pid:this.info.userid
				// }).then(res=>{
				// 	if(res.code==4000){
				// 		uni.showToast({
				// 			title:"解绑成功",
				// 			icon:"none"
				// 		})
				// 	uni.navigateBack({
				// 	    delta: 1
				// 	});

				// 	}
				// })
			}
		}
	}
</script>
<style>
	.u-modal__content{
		text-align: center;
	}
</style>
<style lang="scss" scoped>
.cardinfo{
	width: 100%;
	background-color: #F6F6F6;
	padding-bottom: 150rpx;
	padding-top: 180rpx;
	.uerinfo{
		width: 95%;
		// height: 600rpx;
		border-radius: 10rpx;
		margin: 20rpx auto;
		background-color: #FFFFFF;
		overflow: hidden;
		.userinfoitem{
			width: 95%;
			margin: 0 auto;
			height: 100rpx;
			display: flex;
			justify-content: space-between;
			.iteml{
				font-size: 32rpx;
				line-height: 100rpx;
				color: #888;
			}
			.itemr{
				font-size: 32rpx;
				line-height: 100rpx;
				color: #333;
			}
		}
		.userinfoitem:last-child{
			border: none;
		}
	}
	.cardimg{
		width: 95%;
		height: 600rpx;
		border-radius: 10rpx;
		margin: 20rpx auto;
		background-color: #FFFFFF;
		overflow: hidden;
		.img{
			width: 450rpx;
			height: 450rpx;
			margin: 0 auto;
			margin-top: 30rpx;
			image{
				width: 100%;
				height: 100%;
			}
		}
		.info{
			width: 100%;
			text-align: center;
			font-size: 32rpx;
			color: #959595;
			margin-top: 20rpx;
		}
	}
	.jibang{
		width: 95%;
		height: 100rpx;
		text-align: center;
		font-size: 32rpx;
		color: #333;
		line-height: 100rpx;
		background-color: #f0f0f2;
		// border: 1rpx solid #3669F8;
		border-radius: 10rpx;
		margin: 0 auto;
		margin-top: 40rpx;
	}
	
}
</style>
